package com.attendancesystem.model;

import java.time.LocalDateTime;

public class Lecture {
    private int lectureId;
    private int courseId;
    private String className;
    private LocalDateTime lectureTime;
    private String classroom;
    private LectureStatus status;
    private String summary;
    private String courseName;

    // 枚举定义
    public enum LectureStatus {
        SCHEDULED("已安排"),
        COMPLETED("已完成"),
        CANCELLED("已取消");

        private final String chineseName;

        LectureStatus(String chineseName) {
            this.chineseName = chineseName;
        }

        public String getChineseName() {
            return chineseName;
        }
        public static LectureStatus fromChineseName(String chineseName) {
            for (LectureStatus lectureStatus : values()) {
                if (lectureStatus.chineseName.equals(chineseName)) {
                    return lectureStatus;
                }
            }
            throw new IllegalArgumentException("无效的状态值: " + chineseName);
        }
    }

    // 构造方法
    public Lecture() {}

    public Lecture(int lectureId,int courseId, String className, LocalDateTime lectureTime,
                   String classroom, LectureStatus status,
                   String courseName, String summary) {
        this.lectureId = lectureId;
        this.courseId = courseId;
        this.className = className;
        this.lectureTime = lectureTime;
        this.classroom = classroom;
        this.status = status;
        this.summary = summary;
        this.courseName = courseName;
    }

    // Getter和Setter方法
    public int getLectureId() {
        return lectureId;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setLectureId(int lectureId) {
        this.lectureId = lectureId;
    }

    public int getCourseId() {
        return courseId;
    }

    public void setCourseId(int courseId) {
        this.courseId = courseId;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public LocalDateTime getLectureTime() {
        return lectureTime;
    }

    public void setLectureTime(LocalDateTime lectureTime) {
        this.lectureTime = lectureTime;
    }

    public String getClassroom() {
        return classroom;
    }

    public void setClassroom(String classroom) {
        this.classroom = classroom;
    }

    public LectureStatus getStatus() {
        return status;
    }

    public void setStatus(LectureStatus status) {
        this.status = status;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    // toString方法
    @Override
    public String toString() {
        return "Lecture{" +
                "lectureId=" + lectureId +
                ", courseId=" + courseId +
                ", className='" + className + '\'' +
                ", lectureTime=" + lectureTime +
                ", classroom='" + classroom + '\'' +
                ", status=" + status +
                ", summary='" + summary + '\'' +
                '}';
    }
}

